package com.yanqu.road.server.timer.zhaoshang;

import com.yanqu.road.server.manger.zhaoshang.ZsMgr;
import com.yanqu.road.utils.date.DateHelper;
import com.yanqu.road.utils.executor.GeneralTask;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class ZhaoShangTask extends GeneralTask {


    protected Logger logger = LogManager.getLogger(ZhaoShangTask.class.getName());

    private long lastUpdateTime = 0L;

    private static final long DELAY_MINUTE = 1 * 1000 * 10;   //0点10秒

    @Override
    public void doRun() {

        //启动执行一次
        try {
            if (lastUpdateTime < DateHelper.getTodayZeroTimeStamp() + DELAY_MINUTE) {
                //到跨服取周榜
                ZsMgr.getPreWeekRankTopFromCross();
                lastUpdateTime = DateHelper.getTodayZeroTimeStamp() + DELAY_MINUTE;
            }
        }catch (Exception e) {
            logger.error(e.getMessage(), e);
        }
    }
}
